<template>
  <n-drawer v-model:show="val.md_edityc" class="work_drawer" placement="top">
    <n-drawer-content closable>
      <template #header>编辑主控角色异常值</template>
      <!-- 编辑异常数值 -->
      <div style="margin-top: -15px"></div>
      <n-card class="work_card" preset="card">
        <!-- 标题 -->

        <div class="workbg">
          <n-h3>编辑主控角色异常值</n-h3>
          <n-space>
            <n-space class="work_sp2">
              <span>本专异常类型：</span>
              <div class="dfc" style="gap: 2px 3px">
                <div v-for="(item2, key2) in val.em3">
                  <n-tag
                    style="--n-text-color: var(--n-title-text-color)"
                    @click="val.v_edit_yc.ycl = item2"
                    :bordered="!item2.includes(val.v_edit_yc.ycl)"
                    type="warning"
                    >{{ item2 }}</n-tag
                  >
                </div>
              </div>
            </n-space>
            <n-space class="work_sp2">
              <span>二专异常类型：</span>
              <div class="dfc" style="gap: 2px 3px">
                <div v-for="(item2, key2) in val.em3">
                  <n-tag
                    style="--n-text-color: var(--n-title-text-color)"
                    @click="val.v_edit_yc.ycl2 = item2"
                    :bordered="!item2.includes(val.v_edit_yc.ycl2)"
                    type="warning"
                    >{{ item2 }}</n-tag
                  >
                </div>
              </div>
            </n-space>
          </n-space>

          <br />
          <n-space>
            <n-space class="work_sp2">
              <span>本专异常数值：</span>
              <n-input v-model:value="val.v_edit_yc.yc"></n-input>
            </n-space>
            <n-space class="work_sp2">
              <span>二专异常数值：</span>
              <n-input v-model:value="val.v_edit_yc.yc2"></n-input>
            </n-space>
          </n-space>

          <n-hr />
          <n-space>
            <n-button type="warning" @click="ct.edityc(val.v_ycrole, val.v_edit_yc)"
              >提交异常值</n-button
            >
          </n-space>
          <n-hr />

          <n-space
            class="work_sp2"
            v-if="val.v_edit_yc.ycl != 'none' && val.v_edit_yc.ycl != null"
          >
            <span>本专异常参考：</span>
            <div v-for="(item, key) in val.byc">
              <el-tag class="el-tag--work_ycz"
                >{{ val.bname[key] ?? key }}
                {{ (item[val.v_edit_yc.ycl] * val.v_edit_yc.yc).toFixed(2) }} %</el-tag
              >
            </div>
          </n-space>
          <n-hr />
          <n-space
            class="work_sp2"
            v-if="val.v_edit_yc.ycl2 != 'none' && val.v_edit_yc.ycl2 != null"
          >
            <span>二专异常参考：</span>
            <div v-for="(item, key) in val.byc">
              <el-tag class="el-tag--work_ycz"
                >{{ val.bname[key] ?? key }}
                {{ (item[val.v_edit_yc.ycl2] * val.v_edit_yc.yc2).toFixed(2) }} %</el-tag
              >
            </div>
          </n-space>
        </div>
      </n-card>

      <template #footer>
        <n-button @click="val.md_edityc = false">关闭窗口</n-button>
      </template>
    </n-drawer-content>
  </n-drawer>
</template>
<script>
export default {
  components: {},
  props: {
    val: {
      type: Object,
      required: true,
    },
    ct: {
      type: Object,
      required: true,
    },
  },
};
</script>
